package com.xhwl.centiotdata.controller;


import com.xhwl.centiotdata.pojo.dto.CampusUserStatisticsDTO;
import com.xhwl.common.pojo.cent.iot.CampusUserStatistics;
import com.xhwl.centiotdata.service.ICampusUserStatisticsService;
import com.xhwl.common.pojo.ResultJson;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: JCccc
 * @Description:
 * @Date: 2021/04/27 10:12
 */


@RestController
public class CampusUserStatisticsController {

    @Autowired
    ICampusUserStatisticsService campusUserStatisticsService;

    /**
     * 获取校园业态人员身份统计数据
     *
     * @param appId
     * @param clientType
     * @param industryId
     * @return
     */
    @GetMapping(value = "/campus/user-statistics")
    public ResultJson userStatistics(@RequestHeader(value = "appId", required = true) String appId,
                                     @RequestHeader(value = "clientType", required = false) Integer clientType,
                                     @RequestHeader(value = "industryId", required = true) Short industryId,
                                     CampusUserStatisticsDTO campusUserStatisticsDTO) {
        CampusUserStatistics campusUserStatistics=new CampusUserStatistics();
        BeanUtils.copyProperties(campusUserStatisticsDTO,campusUserStatistics);
        return campusUserStatisticsService.getStatistics(campusUserStatistics);
    }
}
